import { ApiProperty } from '@nestjs/swagger';
import { IsEmail, IsString, MinLength, Validate, IsOptional, IsPhoneNumber } from 'class-validator';
import { Match } from '../decorators/match.decorator';

export class RegisterDto {
  @ApiProperty({ example: 'admin', description: '用户名' })
  @IsString()
  @MinLength(3)
  username: string;

  @ApiProperty({ example: 'admin@example.com', description: '邮箱' })
  @IsEmail()
  email: string;

  @ApiProperty({ example: '+8613800138000', description: '手机号', required: false })
  @IsPhoneNumber()
  @IsOptional()
  phone?: string;

  @ApiProperty({ example: '123456', description: '密码' })
  @IsString()
  @MinLength(6)
  password: string;

  @ApiProperty({ example: '123456', description: '确认密码' })
  @IsString()
  @Match('password', { message: '两次输入的密码不一致' })
  confirmPassword: string;
}

export class RegisterResponseDto {
  @ApiProperty({ example: true, description: '是否注册成功' })
  success: boolean;

  @ApiProperty({ example: '注册成功', description: '提示信息' })
  message: string;
} 